package com.lanxin.xxform.mappers;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.lanxin.xxform.beans.User;
import com.lanxin.xxform.tools.JetCriteria;

@Mapper
public interface UserMapper {

    @Insert("insert into user (name,account,password,createTime,loginTime,ip,status) values (#{name},#{account},#{password},${createTime},${loginTime},#{ip},${status})")
    int insert(User user);

    @Select("select * from user where id=${id}")
    User find(long id);

    @Select("select count(*) from user ${condition}")
    int count(JetCriteria criteria);

    @Select("select ${select} from user ${fullCondition}")
    List<User> findAll(JetCriteria criteria);

    @Update("update user set name=#{name},loginTime=${loginTime},ip=#{ip},status=${status} where id=#{id}")
    int update(User user);
    
}
